<?php
	// Report all errors
	error_reporting( E_ALL );

	// Read the config
	require_once( './config.php' );

	// Autoload drivers
	function __autoload( $what )
	{
		require_once( './core/drivers/'.$what.'.driver.php' );
	}

	// Require core
	require_once( './core/NGenCore.php' );

	// Initialize core
	$ngen = &new NGenCore(
							new page(
										isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '',
										isset( $_REQUEST['a'] ) ? $_REQUEST['a'] : ''
									),
							new sess_session(),
							$settings
						);
	
	// Add sql driver to NGen
	/**
	 * @since Feb 12th, 2008
	 * @update Replaced &$ngen -> $ngen
	 **/
	// Un-comment to enable SQL connection - NOTE: Provide valid credentials in 'config.php'
	// $ngen->db = new sql_mysql( $settings['db'], $ngen );
	
	// Function for reporting errors
	function error_handler_callback($errno, $errstr, $errfile, $errline)
	{
		global $ngen;
		return $ngen->general_error_handler_callback($errno, $errstr, $errfile, $errline);
	}
	
	// Function for reporting exceptions
	function exception_handler_callback($info)
	{
		global $ngen;
		return $ngen->general_error_handler_callback('exception', $info, '', '');
	}
			
	// Load the page
	$ngen->page->load();
?>